import {
	observable,
	computed,
	autorun,
	action
}from 'mobx'

export default class AppState  {
	constructor ({ count,name } = { count : 0, name : 'Caroline'}){
		this.count = count
		this.name = name
	}
	@observable count = 0 
	@observable name = 'Jokcy' 

	@computed get msg(){
		return `${this.name} say count is ${this.count}`
	}
	@action add(){
		this.count += 1
	}
	@action changeName (name){
		this.name = name
	}
	toJson () {
		return {
			count : this.count,
			name : this.name
		}
	}
}